﻿/*
Module Name:  Animation.cs
Project:      ScriptManager
Copyright (C) 2012 Felipe Ramos

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScriptManager.Scripting
{
    public enum Axis { X, Y, Z};

    /// <summary>
    /// Animation object used for tracking axis of animation and offset. This can be extended to support
    /// different animations, but for this example it only supports axis dependend animation with offset value.
    /// </summary>
    public class Animation
    {
        public Axis Axis;
        public string Key;
        public int Offset;
        public int ObjectOffset;

        public static Animation Get(string definition)
        {
            string[] parameters = definition.Split(',');
            return new Animation()
            {
                Key = parameters[0],
                Axis = (Axis)Enum.Parse(typeof(Axis), parameters[1], true),
                Offset = Convert.ToInt32(parameters[2]),
                ObjectOffset = 0
            };
        }
    }
}
